Zebroid allows to expand functionality of program by creating the user plugins. Plugins are written in programming language PHP therefore for creation of plugins you should have at least minimum knowledge of this language.
To create a plugin cause the contextual menu in the list of plugins of the Manager of extension and choose point «Create a plugin». After that can pass on tab «Scripts» for a direct writing of a plugin.
Scripts
Scripts for plugins of Zebroid are carried out on the server part, and it means that on them applied the same rules, as for any other scripts in language PHP. Zebroid only gives additional functions for access to the data of the project and their management.
Built in functions
/**
* returns quantity of records in the current project
*
* @return int
*/
zebroid_count ();
/**
* function returns value of the specified parametre in the necessary record
*
* @param int $rec_indx Serial number of the necessary record
* @param string $param A parametre name (the complete list in the bottom of a post)
* @return string
*/
zebroid_get_data ($rec_indx, $param);
/**
* returns a file of parametres of the necessary record
*
* @param int $rec_indx Serial number of the necessary record
* @return array
*/
zebroid_get_full_data ($rec_indx);
/**
* adds new record and returns its serial number
*
* @param string $title The name of new record
* @param int $parent_id id parental record (if to put-1 then record will appear in a root)
* @param bool $is_static Specifies in, whether there will be a record by static page
* @return int
*/
zebroid_add ($title, $parent_id, $is_static);
/**
* deletes the necessary record (about features of removal read more low)
*
* @param int $rec_indx Serial number of the necessary record
*/
zebroid_delete ($rec_indx);
/**
* searches for record serial number on it id. Returns-1 if it was not possible to find anything
*
* @param int $id id records which are necessary for finding
* @return int
*/
zebroid_get_rec_indx ($id);
/**
* editing and preservation of parametre of record
*
* @param int $rec_indx Serial number of the necessary record
* @param string $param A parametre name
* @param string $value New value of parametre (it should be obligatory line)
*/
zebroid_save_data ($rec_indx, $param, $value);
/**
* editing and preservation of parametre of record
*
* @param int $rec_indx Serial number of the necessary record
* @param array $data A file of parametres of record. The file format should be same as well as that comes back function "zebroid_get_full_data"
*/
zebroid_save_full_data ($rec_indx, $data);
/**
* text translation from an internal format of Zebroida in export (заменна internal перелинковки and references to drawings)
*
* @param string $text The text which needs to be processed
* @param string $index which identifier of record belongs the text
* @return string
*/
zebroid_export_text ($text, $index);
/**
* Preservation of drawings of the project in the specified directory
*
* @param string $folder A preservation directory
*/
zebroid_save_images (string $folder);
/**
Whether * check is record parental
*
* @param int $rec_indx Serial number of the necessary record
* @return bool
*/
zebroid_is_parent ($rec_indx);
/**
* returns value доп. Fields with a name param. If in a variable to steams to transfer ZEBR_AUTHOR - then value доп will be returned. Fields responsible for the author of article.
*
* @param int $rec_indx Serial number of the necessary record
* @param string $param A name доп. Fields
* @return string
*/
zebroid_addit_field_get ($rec_indx, $param);
/**
* establishes add. field param value. If in a variable to steams to transfer ZEBR_AUTHOR - then value доп will be returned. Fields responsible for the author of article.
*
* @param int $rec_indx Serial number of the necessary record
* @param string $param A name доп. Fields
* @param string $value Established value доп. Fields
*/
zebroid_addit_field_set ($rec_indx, $param, $value);
/**
* returns value of level of an enclosure in a project tree. The very first level - 0
*
* @param int $rec_indx Serial number of the necessary record
* @return int
*/
zebroid_get_lvl ($rec_indx);
/**
Whether * check is record отмеченой
*
* @param int $rec_indx Serial number of the necessary record
* @return bool
*/
zebroid_is_checked (int $rec_indx);
/**
* returns the category address "ЗЕБРОИД\php plugins\classes" which can be used as a shared folder for different plug-ins
*
* @return string
*/
_get_class_dir ();
/**
* installation of a new position bar progress
*
* @param int $position Value of a new position
*/
_pb_set_position ($position);
/**
* installation of the maximum value bar progress
*
* @param int $max New maximum value
*/
_pb_set_max ($max);
/**
* to add to current value bar progress the specified value
*
* @param int $i Delta of displacement bar progress
*/
_pb_add ($i);
/**
* a current position bar progress
*
* @return int
*/
_pb_get_position ();
/**
* the maximum value bar progress
*
* @return int
*/
_pb_get_max ();
/**
* to add a new local picture. Returns a name of a picture for local references
*
* @param string $filename A way to a file
* @return string
*/
_img_add ($filename);
/**
* converts utf8 a line in ansi. By default, all input parametres remain in utf8, and php (for example for file opening) it is obligatory to some to transfer to functions in ansi therefore this converter will be necessary for work of such functions
*
* @param string $str A line
* @return string
*/
_utf8toansi ($str);
/**
* converts ansi a line in utf8
*
* @param string $str A line
* @return string
*/
_ansitoutf8 ($str);
/**
* quantity отмеченых records
*
* @return int
*/
zebroid_count_checked ();
/**
* returns an index of the first record in a tree of the project or-1 if is not present
*
* @param bool $checkedOnly true if noted records and false if all are necessary only
* @return int
*/
zebroid_getFirstTreeRec ($checkedOnly);
/**
* returns an index of the following record in a tree of the project or-1 if is not present
*
* @param int $indx A record index, from which отталкиватся
* @param bool $checkedOnly true if noted records and false if all are necessary only
* @return int
*/
zebroid_getNextTreeRec ($indx, $checkedOnly);
/**
* returns an index of the previous record in a tree of the project or-1 if is not present
*
* @param int $indx A record index, from which отталкиватся
* @param bool $checkedOnly true if noted records and false if all are necessary only
* @return int
*/
zebroid_getPrevTreeRec ($indx, $checkedOnly);
/**
* returns record type: 0 - the Category (or the Forum), 1 - the Post (or a theme at a forum), 2 - the Comment, 3 - Static page
*
* @param int $indx A record index
* @return int
*/
zebroid_record_type ($indx);
Functions that works with Excel
/ **
* loads file contents
*
* @param string $FileName A full way to a file
*/
Excel_LoadFile ($FileName);
/**
* keeps file contents
*
* @param string $FileName A full way to a file
*/
Excel_SaveFile ($FileName);
/**
* returns cell contents
*
* @param string $col Alphabetic representation of a column (A, B, C...)
* @param int $row A line number (since zero)
* @return string
*/
Excel_ReadCell ($col, $row);
/**
* writes down in a cell value value
*
* @param string $col Alphabetic representation of a column (A, B, C...)
* @param int $row A line number (since zero)
* @param string $value Value which needs to be written down
*/
Excel_WriteCell ($col, $row, $value);
Attention: Work with these functions is better since function Excel_LoadFile even if you need to keep nothing. By a call of this function the program remembers on expansion of a file with what type to it is necessary to work further and on it depends in what format will be preservation made.
Example of loading and work with a file:
Excel_LoadFile (' C: \\myfile.xls ');//we Open a file
$buf = Excel_ReadCell ('A',0);//It is read out cell contents in a variable buf
WriteToLog ($buf);//It is deduced contained in a broad gull
Preservation example in a new file:
Excel_LoadFile('.xlsx ');//It is necessary, that we will establish with what format to work
Excel_WriteCell ('A',0,'Hello world!!!');//It is written down in a cell
Excel_SaveFile ('C:\\myfile.xlsx');//It is kept in a file
Features of work with the data
- At removal its record id changes on-1. Whether this sign can be used to learn is worked we at present with remote record
- If remote record to establish id excellent from-1, then such record will be restored
- If records to change parametre parent_id — then record will be moved to the new parent
- If records to change value is_static — then record will be moved to a corresponding tree
List of parametres of record
- id — the record identifier
- is_static — whether value defining static is page or not
- title — a record name
- alt_name — alt_name records
- keywords — keywords records
- description — description records
- text — the record text (HTML)
- tags — record labels
- date — date of the publication of record in a format дд.мм.гггг чч: нн: сс
- draught — whether value defining is record draught
- parent_id — id parental record (-1 if record is in a root or it is static page)
- zebrum_h1 — parametre h1 in properties Zebrum Lite
- zebrum_menu — parametre menu in properties Zebrum Lite
- zebrum_template — parametre template in properties Zebrum Lite
- zebrum_template_zhtml — parametre template_zhtml in properties Zebrum Lite
- zebrum_time — parametre time in properties Zebrum Lite
- zebrum_sort — parametre sort in properties Zebrum Lite
- zebrum_menuid — parametre menuid in properties Zebrum Lite
- zebrum_nosubmenu — parametre nosubmenu in properties Zebrum Lite
- zebrum_nomenuitem — parametre nomenuitem in properties Zebrum Lite
- zebrum_menuorder — parametre menuorder in properties Zebrum Lite
- zebrum_module — parametre module in properties Zebrum Lite
- zebrum_params — parametre params in properties Zebrum Lite
- zebrum_donotlist — parametre donotlist in properties Zebrum Lite
- zebrum_split — parametre split in properties Zebrum Lite
- zebrum_filter — parametre filter in properties Zebrum Lite
- zebrum_charset — parametre charset in properties Zebrum Lite
Attention: all parametres at preservation to be obligatory in the line. Even if the parameter has numerical character, all the same it at preservation should is stored as a line, differently the interpreter it will pass